legacyformat.h \
lowranceusr.h \
magellan.h \
- mapbar_track.h \
navilink.h \
nmea.h \
osm.h \
--- /dev/null
+/*
+ China mapbar navigation track reader for sonim xp3300
+ it's maybe can used in other demo devices of mapbar navigation
+
+ Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com
+ Copyright (C) 2001-2013 Robert Lipe, robertlipe+source@gpsbabel.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+#include "mapbar_track.h"
+
+#include <QChar> // for QChar
+#include <QDate> // for QDate
+#include <QString> // for QString
+#include <QTime> // for QTime
+
+#include <cstdio> // for SEEK_CUR
+
+#include "defs.h" // for fatal, Waypoint, track_add_head, track_add_wpt, route_head
+#include "gbfile.h" // for gbfgetint16, gbfgetint32, gbfseek, gbfclose, gbfopen
+#include "src/core/datetime.h" // for DateTime
+
+
+#define MYNAME "mapbar_track"
+
+/*******************************************************************************
+* %%% global callbacks called by gpsbabel main process %%% *
+*******************************************************************************/
+
+void
+MapbarTrackFormat::rd_init(const QString& fname)
+{
+ fin = gbfopen(fname, "r", MYNAME);
+}
+
+void
+MapbarTrackFormat::rd_deinit()
+{
+ gbfclose(fin);
+}
+
+gpsbabel::DateTime
+MapbarTrackFormat::read_datetime() const
+{
+ int hour = gbfgetint16(fin);
+ int min = gbfgetint16(fin);
+ int sec = gbfgetint16(fin);
+ int year = gbfgetint16(fin);
+ int mon = gbfgetint16(fin);
+ int mday = gbfgetint16(fin);
+ gpsbabel::DateTime t(QDate(year, mon, mday), QTime(hour, min, sec));
+ return t;
+}
+
+Waypoint*
+MapbarTrackFormat::read_waypoint() const
+{
+ int longitude = gbfgetint32(fin);
+ int latitude = gbfgetint32(fin);
+
+ auto* ret = new Waypoint;
+
+ ret->latitude = double(latitude)/DIV_RATE;
+ ret->longitude = double(longitude)/DIV_RATE;
+
+ return ret;
+}
+
+void
+MapbarTrackFormat::read()
+{
+ auto* track = new route_head;
+ track_add_head(track);
+
+ (void) read_datetime(); // start_time currently unused
+ (void) read_datetime(); // end_time currently unused
+
+ QChar name[101];
+ // read 100 UCS-2 characters that are each stored little endian.
+ // note gbfread wouldn't get this right on big endian machines.
+ for (int idx=0; idx<100; idx++) {
+ name[idx] = gbfgetint16(fin);
+ }
+ name[100] = u'\0';
+ // At this point, name is a UCS-2 encoded, zero terminated string.
+ // All our internals use Qt encoding, so convert now.
+ track->rte_name = QString(name);
+
+ // skip two pair waypoint
+ gbfseek(fin, 8*4, SEEK_CUR);
+ // skip way length
+ gbfseek(fin, 8, SEEK_CUR);
+ // skip fixed value
+ gbfseek(fin, 4, SEEK_CUR);
+
+ int end_flag = gbfgetint32(fin);
+ while (!end_flag) {
+ int length = gbfgetint32(fin);
+ if ((length < 1) || (length > 1600)) {
+ fatal(MYNAME ": get bad buffer length");
+ }
+
+ if (length % 8 != 0) {
+ fatal(MYNAME ": bad buffer size");
+ }
+ gbfseek(fin, 16, SEEK_CUR);
+
+ const int amount = length/8;
+ for (int i = 0; i < amount; ++i) {
+ Waypoint* tmp = read_waypoint();
+ track_add_wpt(track, tmp);
+ }
+
+ end_flag = gbfgetint32(fin);
+ }
+}
--- /dev/null
+/*
+ China mapbar navigation track reader for sonim xp3300
+ it's maybe can used in other demo devices of mapbar navigation
+
+ Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com
+ Copyright (C) 2001-2013 Robert Lipe, robertlipe+source@gpsbabel.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+#ifndef MAPBAR_TRACK_H_INCLUDED_
+#define MAPBAR_TRACK_H_INCLUDED_
+
+#include <QString> // for QString
+#include <QVector> // for QVector
+
+#include "defs.h" // for ff_cap, arglist_t, ff_cap_none, CET_CHARSET_UTF8, Waypoint, ff_cap_read, ff_type, ff_type_file
+#include "format.h" // for Format
+#include "gbfile.h" // for gbfile
+#include "src/core/datetime.h" // for DateTime
+
+
+class MapbarTrackFormat : public Format
+{
+public:
+ QVector<arglist_t>* get_args() override
+ {
+ return &mapbar_track_args;
+ }
+
+ ff_type get_type() const override
+ {
+ return ff_type_file;
+ }
+
+ QVector<ff_cap> get_cap() const override
+ {
+ /* waypoints, tracks, routes */
+ return { ff_cap_none, (ff_cap)(ff_cap_read), ff_cap_none };
+ }
+
+ QString get_encode() const override
+ {
+ return CET_CHARSET_UTF8;
+ }
+
+ int get_fixed_encode() const override
+ {
+ return 0;
+ }
+
+ void rd_init(const QString& fname) override;
+ void read() override;
+ void rd_deinit() override;
+
+private:
+ /* Constants */
+
+ static constexpr double DIV_RATE = 100000.0f;
+
+ /* Member Functions */
+
+ gpsbabel::DateTime read_datetime() const;
+ Waypoint* read_waypoint() const;
+
+ /* Data Members */
+
+ gbfile* fin{};
+
+ QVector<arglist_t> mapbar_track_args = {
+ };
+};
+#endif // MAPBAR_TRACK_H_INCLUDED_
+++ /dev/null
-/*
- China mapbar navigation track reader for sonim xp3300
- it's maybe can used in other demo devices of mapbar navigation
-
- Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com
- Copyright (C) 2001-2013 Robert Lipe, robertlipe+source@gpsbabel.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- */
-
-#include "mapbar_track.h"
-
-#include <QChar> // for QChar
-#include <QDate> // for QDate
-#include <QString> // for QString
-#include <QTime> // for QTime
-
-#include <cstdio> // for SEEK_CUR
-
-#include "defs.h" // for fatal, Waypoint, track_add_head, track_add_wpt, route_head
-#include "gbfile.h" // for gbfgetint16, gbfgetint32, gbfseek, gbfclose, gbfopen
-#include "src/core/datetime.h" // for DateTime
-
-
-#define MYNAME "mapbar_track"
-
-/*******************************************************************************
-* %%% global callbacks called by gpsbabel main process %%% *
-*******************************************************************************/
-
-void
-MapbarTrackFormat::rd_init(const QString& fname)
-{
- fin = gbfopen(fname, "r", MYNAME);
-}
-
-void
-MapbarTrackFormat::rd_deinit()
-{
- gbfclose(fin);
-}
-
-gpsbabel::DateTime
-MapbarTrackFormat::read_datetime() const
-{
- int hour = gbfgetint16(fin);
- int min = gbfgetint16(fin);
- int sec = gbfgetint16(fin);
- int year = gbfgetint16(fin);
- int mon = gbfgetint16(fin);
- int mday = gbfgetint16(fin);
- gpsbabel::DateTime t(QDate(year, mon, mday), QTime(hour, min, sec));
- return t;
-}
-
-Waypoint*
-MapbarTrackFormat::read_waypoint() const
-{
- int longitude = gbfgetint32(fin);
- int latitude = gbfgetint32(fin);
-
- auto* ret = new Waypoint;
-
- ret->latitude = double(latitude)/DIV_RATE;
- ret->longitude = double(longitude)/DIV_RATE;
-
- return ret;
-}
-
-void
-MapbarTrackFormat::read()
-{
- auto* track = new route_head;
- track_add_head(track);
-
- (void) read_datetime(); // start_time currently unused
- (void) read_datetime(); // end_time currently unused
-
- QChar name[101];
- // read 100 UCS-2 characters that are each stored little endian.
- // note gbfread wouldn't get this right on big endian machines.
- for (int idx=0; idx<100; idx++) {
- name[idx] = gbfgetint16(fin);
- }
- name[100] = u'\0';
- // At this point, name is a UCS-2 encoded, zero terminated string.
- // All our internals use Qt encoding, so convert now.
- track->rte_name = QString(name);
-
- // skip two pair waypoint
- gbfseek(fin, 8*4, SEEK_CUR);
- // skip way length
- gbfseek(fin, 8, SEEK_CUR);
- // skip fixed value
- gbfseek(fin, 4, SEEK_CUR);
-
- int end_flag = gbfgetint32(fin);
- while (!end_flag) {
- int length = gbfgetint32(fin);
- if ((length < 1) || (length > 1600)) {
- fatal(MYNAME ": get bad buffer length");
- }
-
- if (length % 8 != 0) {
- fatal(MYNAME ": bad buffer size");
- }
- gbfseek(fin, 16, SEEK_CUR);
-
- const int amount = length/8;
- for (int i = 0; i < amount; ++i) {
- Waypoint* tmp = read_waypoint();
- track_add_wpt(track, tmp);
- }
-
- end_flag = gbfgetint32(fin);
- }
-}
+++ /dev/null
-/*
- China mapbar navigation track reader for sonim xp3300
- it's maybe can used in other demo devices of mapbar navigation
-
- Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com
- Copyright (C) 2001-2013 Robert Lipe, robertlipe+source@gpsbabel.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- */
-#ifndef MAPBAR_TRACK_H_INCLUDED_
-#define MAPBAR_TRACK_H_INCLUDED_
-
-#include <QString> // for QString
-#include <QVector> // for QVector
-
-#include "defs.h" // for ff_cap, arglist_t, ff_cap_none, CET_CHARSET_UTF8, Waypoint, ff_cap_read, ff_type, ff_type_file
-#include "format.h" // for Format
-#include "gbfile.h" // for gbfile
-#include "src/core/datetime.h" // for DateTime
-
-
-class MapbarTrackFormat : public Format
-{
-public:
- QVector<arglist_t>* get_args() override
- {
- return &mapbar_track_args;
- }
-
- ff_type get_type() const override
- {
- return ff_type_file;
- }
-
- QVector<ff_cap> get_cap() const override
- {
- /* waypoints, tracks, routes */
- return { ff_cap_none, (ff_cap)(ff_cap_read), ff_cap_none };
- }
-
- QString get_encode() const override
- {
- return CET_CHARSET_UTF8;
- }
-
- int get_fixed_encode() const override
- {
- return 0;
- }
-
- void rd_init(const QString& fname) override;
- void read() override;
- void rd_deinit() override;
-
-private:
- /* Constants */
-
- static constexpr double DIV_RATE = 100000.0f;
-
- /* Member Functions */
-
- gpsbabel::DateTime read_datetime() const;
- Waypoint* read_waypoint() const;
-
- /* Data Members */
-
- gbfile* fin{};
-
- QVector<arglist_t> mapbar_track_args = {
- };
-};
-#endif // MAPBAR_TRACK_H_INCLUDED_
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<gpx version="1.0" creator="GPSBabel - https://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/0">
- <time>1970-01-01T00:00:00Z</time>
- <bounds minlat="23.170610000" minlon="113.295130000" maxlat="23.175130000" maxlon="113.297530000"/>
- <trk>
- <name>山顶到豆腐花</name>
- <trkseg>
- <trkpt lat="23.175110000" lon="113.295130000"/>
- <trkpt lat="23.175130000" lon="113.295240000"/>
- <trkpt lat="23.175090000" lon="113.295350000"/>
- <trkpt lat="23.175040000" lon="113.295530000"/>
- <trkpt lat="23.174980000" lon="113.295640000"/>
- <trkpt lat="23.174940000" lon="113.295740000"/>
- <trkpt lat="23.174850000" lon="113.295850000"/>
- <trkpt lat="23.174760000" lon="113.295940000"/>
- <trkpt lat="23.174620000" lon="113.295980000"/>
- <trkpt lat="23.174460000" lon="113.296010000"/>
- <trkpt lat="23.174360000" lon="113.296030000"/>
- <trkpt lat="23.174200000" lon="113.296060000"/>
- <trkpt lat="23.174120000" lon="113.296120000"/>
- <trkpt lat="23.174030000" lon="113.296200000"/>
- <trkpt lat="23.173940000" lon="113.296390000"/>
- <trkpt lat="23.173890000" lon="113.296500000"/>
- <trkpt lat="23.173820000" lon="113.296600000"/>
- <trkpt lat="23.173720000" lon="113.296570000"/>
- <trkpt lat="23.173630000" lon="113.296520000"/>
- <trkpt lat="23.173520000" lon="113.296480000"/>
- <trkpt lat="23.173380000" lon="113.296490000"/>
- <trkpt lat="23.173260000" lon="113.296490000"/>
- <trkpt lat="23.173120000" lon="113.296480000"/>
- <trkpt lat="23.172940000" lon="113.296470000"/>
- <trkpt lat="23.172790000" lon="113.296510000"/>
- <trkpt lat="23.172670000" lon="113.296560000"/>
- <trkpt lat="23.172580000" lon="113.296660000"/>
- <trkpt lat="23.172500000" lon="113.296800000"/>
- <trkpt lat="23.172410000" lon="113.296940000"/>
- <trkpt lat="23.172320000" lon="113.297080000"/>
- <trkpt lat="23.172230000" lon="113.297170000"/>
- <trkpt lat="23.172120000" lon="113.297250000"/>
- <trkpt lat="23.172030000" lon="113.297330000"/>
- <trkpt lat="23.171930000" lon="113.297460000"/>
- <trkpt lat="23.171820000" lon="113.297530000"/>
- <trkpt lat="23.171870000" lon="113.297370000"/>
- <trkpt lat="23.171960000" lon="113.297280000"/>
- <trkpt lat="23.172040000" lon="113.297180000"/>
- <trkpt lat="23.172090000" lon="113.297060000"/>
- <trkpt lat="23.172170000" lon="113.296920000"/>
- <trkpt lat="23.172230000" lon="113.296790000"/>
- <trkpt lat="23.172270000" lon="113.296660000"/>
- <trkpt lat="23.172290000" lon="113.296520000"/>
- <trkpt lat="23.172250000" lon="113.296380000"/>
- <trkpt lat="23.172240000" lon="113.296240000"/>
- <trkpt lat="23.172230000" lon="113.296110000"/>
- <trkpt lat="23.172140000" lon="113.296020000"/>
- <trkpt lat="23.172050000" lon="113.296120000"/>
- <trkpt lat="23.172060000" lon="113.296240000"/>
- <trkpt lat="23.172090000" lon="113.296360000"/>
- <trkpt lat="23.172120000" lon="113.296470000"/>
- <trkpt lat="23.172130000" lon="113.296610000"/>
- <trkpt lat="23.172100000" lon="113.296710000"/>
- <trkpt lat="23.172050000" lon="113.296820000"/>
- <trkpt lat="23.171960000" lon="113.296920000"/>
- <trkpt lat="23.171860000" lon="113.297010000"/>
- <trkpt lat="23.171750000" lon="113.297100000"/>
- <trkpt lat="23.171580000" lon="113.297170000"/>
- <trkpt lat="23.171450000" lon="113.297250000"/>
- <trkpt lat="23.171310000" lon="113.297270000"/>
- <trkpt lat="23.171170000" lon="113.297300000"/>
- <trkpt lat="23.171010000" lon="113.297210000"/>
- <trkpt lat="23.170850000" lon="113.297170000"/>
- <trkpt lat="23.170750000" lon="113.297140000"/>
- <trkpt lat="23.170610000" lon="113.297100000"/>
- <trkpt lat="23.170640000" lon="113.296990000"/>
- </trkseg>
- </trk>
-</gpx>